<span page-title>{{ 'Lifecycle Environment Paths' | translate }}</span>

<section ng-cloak bst-container-scroll>

  <div class="row">
    <h2 class="col-sm-12">
      <span data-block="header" translate>
        Lifecycle Environment Paths
      </span>

      <a class="fr btn btn-primary"
          ui-sref="environments.new({priorId: library.id})"
          ng-disabled="!library.id"
          ng-hide="denied('create_lifecycle_environments', library)">
        <i class="pficon pficon-add-circle-o"></i>
        {{ "Create Environment Path" | translate }}
      </a>
    </h2>
  </div>

  <section class="row">
    <div class="col-sm-12">
      <div ng-hide="denied('view_lifecycle_environments', library)">
        <table class="table table-bordered info-blocks">
          <tbody>
            <tr>
              <td class="info-block-head"><a ui-sref="environment.details({environmentId: library.id})" translate>Library</a></td>
              <td class="info-block" translate>Content Views <div>{{ library.counts.content_views || 0 }}</div></td>
              <td class="info-block" translate>Products <div>{{ library.counts.products || 0 }}</div></td>
              <td class="info-block" ng-hide="library.counts.yum_repositories == 0" translate>
                Yum Repositories <div>{{ library.counts.yum_repositories || 0 }}</div>
              </td>
              <td class="info-block" ng-hide="library.counts.ostree_repositories == 0" translate>
                OSTree Repositories <div>{{ library.counts.ostree_repositories || 0 }}</div>
              </td>
              <td class="info-block" ng-hide="library.counts.docker_repositories == 0" translate>
                Docker Repositories <div>{{ library.counts.docker_repositories || 0 }}</div>
              </td>
              <td class="info-block" ng-hide="library.counts.packages == 0" translate>
                Packages <div>{{ library.counts.packages || 0 }}</div>
              </td>
              <td class="info-block" ng-hide="library.counts.errata.total == 0" translate>
                Errata <div>{{ library.counts.errata.total || 0 }}</div>
              </td>
              <td class="info-block" ng-hide="library.counts.module_streams == 0"  translate>
                Module Streams <div>{{ library.counts.module_streams || 0 }}</div>
              </td>
            </tr>
          </tbody>
        </table>
      </div>

      <div class="environment" ng-repeat="path in paths">
        <div class="row">
          <div class="col-sm-12">
            <a ng-hide="denied('create_lifecycle_environments', path['environments'][0])" ui-sref="environments.new({priorId: lastEnvironment(path).id})" class="btn btn-default fr">
              <i class="fa fa-plus inline-icon"></i>
              <span translate>Add New Environment</span>
            </a>
          </div>
        </div>

        <table class="table table-bordered environment-table" ng-hide="denied('view_lifecycle_environments', path.environments[0])">
          <thead>
            <tr>
              <th></th>
              <th ng-repeat="environment in path.environments">
                <a ui-sref="environment.details({environmentId: environment.id})">
                  {{ environment.name }}
                </a>
              </th>
            </tr>
          </thead>

          <tbody>
            <tr>
              <td translate>Content Views</td>
              <td ng-repeat="environment in path.environments">{{ environment.counts.content_views || 0 }}</td>
            </tr>
            <tr>
              <td translate>Content Hosts</td>
              <td ng-repeat="environment in path.environments">{{ environment.counts.content_hosts || 0 }}</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </section>
</section>
